package org.example.controller.yy;

import io.swagger.annotations.Api;
import org.example.entity.yy.Region;
import org.example.service.yy.RegionService;
import org.example.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "地区")
@RequestMapping("/yy/dq")
@CrossOrigin
public class RegionController {

    @Autowired
    private RegionService regionService;

    //查询全部景点
    @GetMapping("/select-all-attractions")
    public Result selectAllAttractions() {
        List<Region> list = regionService.list();
        if (!list.isEmpty()) {
            return new Result<>("200", "查询成功", list);
        }else {
            return new Result<>("400", "查询失败", null);
        }
    }
}
